package com.apigen.platform.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Map;

/**
 * 模板请求DTO
 *
 * @author API Generator Platform
 * @since 2025-09-24
 */
@Data
@Schema(description = "模板配置参数")
public class TemplateRequest {

    @Schema(description = "模板ID（更新时必填）", example = "1")
    private Long templateId;

    @NotBlank(message = "模板名称不能为空")
    @Schema(description = "模板名称", example = "Spring Boot Admin Template")
    private String templateName;

    @NotBlank(message = "模板编码不能为空")
    @Pattern(regexp = "^[a-z][a-z0-9-]*[a-z0-9]$", message = "模板编码只能包含小写字母、数字和连字符，且必须以字母开头")
    @Schema(description = "模板编码", example = "spring-boot-admin")
    private String templateCode;

    @Schema(description = "模板描述", example = "基于Spring Boot的后台管理系统模板")
    private String description;

    @NotBlank(message = "模板类型不能为空")
    @Schema(description = "模板类型", example = "BACKEND", allowableValues = {"BACKEND", "FRONTEND", "FULLSTACK", "API", "MICROSERVICE"})
    private String templateType;

    @NotBlank(message = "技术栈不能为空")
    @Schema(description = "技术栈", example = "Spring Boot + MyBatis Plus + Vue 3")
    private String techStack;

    @Schema(description = "适用场景", example = "后台管理系统、企业级应用")
    private String useCase;

    @Schema(description = "模板版本", example = "1.0.0")
    private String version = "1.0.0";

    @Schema(description = "作者", example = "API Generator Team")
    private String author;

    @Schema(description = "许可证", example = "MIT")
    private String license = "MIT";

    @Schema(description = "官网地址", example = "https://example.com")
    private String homepage;

    @Schema(description = "Git仓库地址", example = "https://gitee.com/example/template")
    private String repositoryUrl;

    @Schema(description = "演示地址", example = "https://demo.example.com")
    private String demoUrl;

    @Schema(description = "文档地址", example = "https://docs.example.com")
    private String documentUrl;

    @Schema(description = "封面图片", example = "/images/template-cover.jpg")
    private String coverImage;

    @Schema(description = "截图列表", example = "['/images/screenshot1.jpg', '/images/screenshot2.jpg']")
    private String screenshots;

    @Schema(description = "标签", example = "管理系统,Vue3,Element Plus")
    private String tags;

    @NotNull(message = "是否启用不能为空")
    @Schema(description = "是否启用", example = "true")
    private Boolean isEnabled = true;

    @Schema(description = "是否推荐", example = "false")
    private Boolean isRecommended = false;

    @Schema(description = "排序", example = "100")
    private Integer sortOrder = 100;

    @Schema(description = "下载次数", example = "0")
    private Integer downloadCount = 0;

    @Schema(description = "评分", example = "5.0")
    private Double rating = 5.0;

    @Schema(description = "模板配置（JSON格式）")
    private Map<String, Object> templateConfig;

    @Schema(description = "依赖配置（JSON格式）")
    private Map<String, Object> dependencies;

    @Schema(description = "特性列表（JSON格式）")
    private Map<String, Object> features;
}










